#include<stdio.h>

int main() 
{ 

#ifdef FILEIO
  freopen("in.txt","r",stdin); 
  freopen("out.txt","w",stdout); 
#endif
  int a[11][11];
  int n;
  int caseno = 1;
  int i,j;
  scanf("%d",&n);
  while(n != 0)
    {
      for(i = 0;i<n;i++)
        {
          for(j = 0;j<n;j++)
            {
              scanf("%d",&a[i][j]);
            }
        }
      printf("Case %d:\n",caseno++);
      for(i = 0;i<n;i++)
        {
          for(j = 0;j<n;j++)
            {
              printf("%d ",a[i][j]);
            }
          printf("\n");
        }
      
      scanf("%d",&n);
    }

#ifdef FILEIO
  fclose(stdin);
  fclose(stdout);
#endif
  
  return 0; 
} 
